<?php get_header(); ?>

	<div id="content">

		   <?php if (have_posts()) : ?>
    
          <?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
          <?php /* If this is a category headhive */ if (is_category()) { ?>
            <h3 class="head">Archive for the &#8216;<?php single_cat_title(); ?>&#8217; Category</h3>
          <?php /* If this is a tag headhive */ } elseif( is_tag() ) { ?>
            <h3 class="head">Posts Tagged &#8216;<?php single_tag_title(); ?>&#8217;</h3>
          <?php /* If this is a daily headhive */ } elseif (is_day()) { ?>
            <h3 class="head">Archive for <?php the_time('F jS, Y'); ?></h3>
          <?php /* If this is a monthly headhive */ } elseif (is_month()) { ?>
            <h3 class="head">Archive for <?php the_time('F, Y'); ?></h3>
          <?php /* If this is a yearly headhive */ } elseif (is_year()) { ?>
            <h3 class="head">Archive for <?php the_time('Y'); ?></h3>
          <?php /* If this is an author headhive */ } elseif (is_author()) { ?>
            <h3 class="head">Author Archive</h3>
          <?php /* If this is a paged headhive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
            <h3 class="head">Blog Archives</h3>
          <?php } ?>
          
          <div class="clearer"></div>
    

        <div id="entrie" class="arch">
        	<div id="entries2">
				 <?php while (have_posts()) : the_post(); ?>
        
				<!-- start entry post -->
                <div class="post" id="post-<?php the_ID(); ?>">
                    <div class="etext">                                                                    
                        <div class="entryinfo">
                          <span class="comm"><?php comments_popup_link('0 Comments', '1 Comment', '% Comments'); ?></span> <span class="date"><?php the_time('F jS, Y') ?></span> | <span class="cat"><?php the_category(', ') ?></span> <?php edit_post_link('Edit', '| <span class="edit">', ' </span>'); ?>
                          <div class="clearer"></div> 
                        </div>
                        <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
                        <?php  if((get_post_meta($post->ID, "image", true))) { ?>
                        <a href="<?php the_permalink() ?>" rel="bookmark" title="Continue reading <?php the_title(); ?>"><img class="epic" src="<?php bloginfo('template_directory'); ?>/scripts/timthumb.php?src=<?php echo get_post_meta($post->ID, "image", true); ?>&h=125&w=140&zc=1&cropfrom=topleft" alt="Continue reading <?php the_title(); ?>" /></a>
                        <?php } ?> 
                        <div class="excerpt"><?php the_excerpt(); ?></div>
                    </div>
                </div>
                 <!-- end entry post -->	
                 
			    <?php endwhile; ?>
            </div>
        </div>
    
            <div class="navigation">
                <div class="alignleft"><?php next_posts_link('&larr; Older Entries') ?></div>
                <div class="alignright"><?php previous_posts_link('Newer Entries &rarr;') ?></div>
            </div>

				<?php else :
            
                    if ( is_category() ) { // If this is a category headhive
                        printf("<div class='post'><div class='entry'><h2>Sorry, but there aren't any posts in the %s category yet.</h2></div></div>", single_cat_title('',false));
                    } else if ( is_date() ) { // If this is a date headhive
                        echo("<div class='post'><div class='entry'><h2>Sorry, but there aren't any posts with this date.</h2></div></div>");
                    } else if ( is_author() ) { // If this is a category headhive
                        $userdata = get_userdatabylogin(get_query_var('author_name'));
                        printf("<div class='post'><div class='entry'><h2>Sorry, but there aren't any posts by %s yet.</h2></div></div>", $userdata->display_name);
                    } else {
                        echo("<div class='post'><div class='entry'><h2>No posts found.</h2></div></div>");
                    }
                    ;
            
                endif;
            ?>

	</div>

<?php get_sidebar(); ?>

<?php get_footer(); ?>
